#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;
const int N = 1e5 + 10;

int n, m;
int q[N];
int w[N];

void solve(){
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i ++){
        scanf("%d", &q[i]);
    }

    sort(q, q + m);

    // for(int i = 0; i < m; i ++){
    //     cout << q[i] << " ";
    // }
    // cout << endl;
    // cout << "---------------------------------" << endl;


    int cnt = 0;
    for(int i = 0; i + 1 < m; i ++){
        int temp = q[i + 1] - q[i] - 1;
        if(temp > 0){
            w[cnt ++] = temp;
        }
    }


    if(n - q[m - 1] + q[0] - 1 > 0){
        w[cnt ++] = n - q[m - 1] + q[0] - 1;
    } 

    sort(w, w + cnt, greater<int>());


    // for(int i = 0; i < cnt; i ++){
    //     cout << w[i] << " ";
    // }

    // cout << endl;
    // cout << "---------------------------------------" << endl;

    int res = 0;
    for(int i = 0; i < cnt; i ++){
        if(i == 0){
            if(w[i] > 1){
                res += w[i] - 1;
            }else if(w[i] == 1){
                res += 1;
                printf("%d\n", n - res);
                return;
            }else{
                printf("%d\n", n - res);
                return;
            }
        }else{
            if(w[i] - i * 2 * 2 - 1 > 0){
                res += w[i] - i * 4 - 1;
            }else if(w[i] - i * 4 - 1 == 0){
                res += 1;
                printf("%d\n", n - res);
                return;
            }else{
                printf("%d\n", n - res);
                return;
            }
        }
    }
    printf("%d\n", n - res);
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    int T;

    scanf("%d", &T);
    while(T--){
        solve();
    }
    return 0;
}